package com.nowcoder.community.entity;

import java.util.HashMap;
import java.util.Map;

/**
 * @author xiexu
 * @create 2022-06-07 18:35
 */
public class Event {

    /**
     * 事件的类型
     */
    private String topic;

    /**
     * 事件的触发人，例如：张三给李四点赞，userId就是张三
     */
    private int userId;

    /**
     * 事件发生的实体类型(点赞、回复、关注)
     */
    private int entityType;

    /**
     * 实体id，例如：张三给李四点赞，entityId就是李四
     */
    private int entityId;

    /**
     * 实体的作者(帖子、评论的作者)
     */
    private int entityUserId;

    /**
     * 封装其他额外的数据
     */
    private Map<String, Object> data = new HashMap<>();

    public String getTopic() {
        return topic;
    }

    public Event setTopic(String topic) {
        this.topic = topic;
        return this;
    }

    public int getUserId() {
        return userId;
    }

    public Event setUserId(int userId) {
        this.userId = userId;
        return this;
    }

    public int getEntityType() {
        return entityType;
    }

    public Event setEntityType(int entityType) {
        this.entityType = entityType;
        return this;
    }

    public int getEntityId() {
        return entityId;
    }

    public Event setEntityId(int entityId) {
        this.entityId = entityId;
        return this;
    }

    public int getEntityUserId() {
        return entityUserId;
    }

    public Event setEntityUserId(int entityUserId) {
        this.entityUserId = entityUserId;
        return this;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public Event setData(String key, Object value) {
        this.data.put(key, value);
        return this;
    }
}
